package com.aacar.dao.impl;

import com.aacar.dao.OrderDao;
import com.aacar.dao.base.CommonBaseDao;
import com.aacar.entity.Order;
import com.aacar.entity.OrderPay;

import java.util.Map;

import org.springframework.stereotype.Repository;

@Repository("orderDao")
public class OrderDaoImpl extends CommonBaseDao<Order, String> implements OrderDao {

	private static final String nameSpace = "com.aacar.dao.OrderDao.";


	@Override
	public int save(Order order) {
		return saveObject(nameSpace.concat("save"), order);
	}

	@Override
	public int update(Order order) {
		return super.getSqlSession().update(nameSpace.concat("update"), order);
	}

	@Override
	public Order getOrder(String orderNo) {
		return super.getSqlSession().selectOne(nameSpace.concat("getOrder"), orderNo);
	}

	@Override
	public int findNotCancelCount(Long userId) {
		return super.getSqlSession().selectOne(nameSpace.concat("findNotCancelCount"), userId);
	}

	@Override
	public Map findCouponByUserId(String userId) {
		// TODO Auto-generated method stub
		return super.getSqlSession().selectOne(nameSpace.concat("findCouponByUserId"), userId);
	}
	@Override
	public Map findCouponByCarNo(String carNo) {
		// TODO Auto-generated method stub
		return super.getSqlSession().selectOne(nameSpace.concat("findCouponByCarNo"), carNo);
	}

}
